<html>
<head><meta charset="utf-8"><title>Name resolution librarification 2019-04-18 · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html">Name resolution librarification 2019-04-18</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="163648789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163648789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163648789">(Apr 18 2019 at 13:01)</a>:</h4>
<p>Hello <span class="user-group-mention" data-user-group-id="1060">@WG-rls2.0</span></p>



<a name="163648803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163648803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163648803">(Apr 18 2019 at 13:01)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="163648996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163648996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163648996">(Apr 18 2019 at 13:03)</a>:</h4>
<p>Shall we begin? Since the doodle pool was not too popular, I expect the most interested parties are represented :-)</p>



<a name="163649012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649012">(Apr 18 2019 at 13:03)</a>:</h4>
<p>sure</p>



<a name="163649097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649097">(Apr 18 2019 at 13:04)</a>:</h4>
<p>though I'll say up front: I don't have too much to report (mostly some questions about objectives/scope/requirements)</p>



<a name="163649104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649104">(Apr 18 2019 at 13:04)</a>:</h4>
<p>and given that I didn't finish pre-triage for the compiler meeting in an hour</p>



<a name="163649105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649105">(Apr 18 2019 at 13:04)</a>:</h4>
<p>I don't have any planed agenda for the meeting as well</p>



<a name="163649121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649121">(Apr 18 2019 at 13:04)</a>:</h4>
<p>I might want to just keep this pretty short?</p>



<a name="163649141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649141">(Apr 18 2019 at 13:04)</a>:</h4>
<p>Sure, seems fine!</p>



<a name="163649148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649148">(Apr 18 2019 at 13:05)</a>:</h4>
<p>I've only started a little bit with name resolution librarification stuff</p>



<a name="163649199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649199">(Apr 18 2019 at 13:05)</a>:</h4>
<p>let me start with a couple of ... claims? hypotheses.</p>



<a name="163649215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649215">(Apr 18 2019 at 13:05)</a>:</h4>
<p>sure, go ahead!</p>



<a name="163649297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649297">(Apr 18 2019 at 13:06)</a>:</h4>
<p>1. We want to create a name resolution library that can be used as a reference spec for how name resolution should behave, on <em>correct programs</em></p>



<a name="163649345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649345">(Apr 18 2019 at 13:07)</a>:</h4>
<p>the reason I add that bit at the end, is because <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> made a comment some time ago that a bulk of the complexity in nameres comes from supporting diagnostics for the error cases</p>



<a name="163649360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649360">(Apr 18 2019 at 13:07)</a>:</h4>
<p>but we want at least detect erroneous programs?</p>



<a name="163649440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649440">(Apr 18 2019 at 13:08)</a>:</h4>
<p>I imagine we don't want to claim that a given program is valid</p>



<a name="163649453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649453">(Apr 18 2019 at 13:08)</a>:</h4>
<p>when, based at least on nameres algorithm, it is not valid</p>



<a name="163649503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649503">(Apr 18 2019 at 13:09)</a>:</h4>
<p>yeah, that's what I had in mind, sounds good!</p>



<a name="163649538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649538">(Apr 18 2019 at 13:09)</a>:</h4>
<p>I have imagined a couple different ways to try to construct such an artifact</p>



<a name="163649553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649553">(Apr 18 2019 at 13:09)</a>:</h4>
<p>at this point, my intention is to make a name-resolver that runs in parallel with the existing one</p>



<a name="163649559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649559">(Apr 18 2019 at 13:09)</a>:</h4>
<p>and the two compare their results</p>



<a name="163649564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649564">(Apr 18 2019 at 13:09)</a>:</h4>
<p>for the correct cases</p>



<a name="163649637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649637">(Apr 18 2019 at 13:10)</a>:</h4>
<p>while the reference name-resolver makes no attempt to match diagnostic quality for the incorrect cases</p>



<a name="163649695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649695">(Apr 18 2019 at 13:11)</a>:</h4>
<p>by "runs in parallel"</p>



<a name="163649703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649703">(Apr 18 2019 at 13:11)</a>:</h4>
<p>I don't actually mean on parallel cores</p>



<a name="163649719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649719">(Apr 18 2019 at 13:11)</a>:</h4>
<p>Seems good, longish-term. Short-term, I expect plugging into rustc would be a ton of work. Another way to get <em>something</em> useful is by plugging into rust-analyzer first.</p>



<a name="163649730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649730">(Apr 18 2019 at 13:11)</a>:</h4>
<p>but rather than the code is just added to corresponding points in the control flow of the compiler</p>



<a name="163649793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649793">(Apr 18 2019 at 13:12)</a>:</h4>
<p>Yes, that is the place where I have been wondering about strategy here</p>



<a name="163649807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649807">(Apr 18 2019 at 13:12)</a>:</h4>
<p>namely, plugging into <code>rustc</code> <em>is</em> a ton of work</p>



<a name="163649815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649815">(Apr 18 2019 at 13:12)</a>:</h4>
<p>Could we perhaps reuse save-analysis for comparison?</p>



<a name="163649845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649845">(Apr 18 2019 at 13:12)</a>:</h4>
<p>oh that's an interesting idea</p>



<a name="163649869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649869">(Apr 18 2019 at 13:13)</a>:</h4>
<p>Like, we don't plug code into rustc, we ask rustc to dump data, and then run test-suite against that data</p>



<a name="163649905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649905">(Apr 18 2019 at 13:13)</a>:</h4>
<p>We'll need a parser for rust, of course, but there are a couple available :)</p>



<a name="163649975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649975">(Apr 18 2019 at 13:14)</a>:</h4>
<p>I had been assuming that a reason it made sense to plug into rustc was that this would simultanously: 1. yield the testing infrastructure (since its just a mode you turn on via a rustc flag), and 2. yield a software artifact that we would be semi-confident in at the outset (since it was written to match the control-flow of rustc itself)</p>



<a name="163649985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163649985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163649985">(Apr 18 2019 at 13:14)</a>:</h4>
<p>but I hadn't considered that save-analysis gives us an alternative path for testing</p>



<a name="163650030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650030">(Apr 18 2019 at 13:15)</a>:</h4>
<p>so, lets try the thought experiment then</p>



<a name="163650034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650034">(Apr 18 2019 at 13:15)</a>:</h4>
<p>Plugging direrctly into rustc runs the risk of replicating rustc's interface, which may not be ideal</p>



<a name="163650063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650063">(Apr 18 2019 at 13:15)</a>:</h4>
<p>right, that is the risk: How to make something general purpose enough that it can be reused elsewhere</p>



<a name="163650156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650156">(Apr 18 2019 at 13:16)</a>:</h4>
<p>do you think it makes sense to try to plan ahead for eventual integration with rustc (the aforementioned testing strategy, lets call it Just-in-Time Testing)</p>



<a name="163650190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650190">(Apr 18 2019 at 13:17)</a>:</h4>
<p>because I was semi-concerned about the <em>opposite</em> problem: If i start with Rust-analyzer's nameresolver</p>



<a name="163650205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650205">(Apr 18 2019 at 13:17)</a>:</h4>
<p>I may end up with something that I cannot effectively plug into <code>rustc</code> ?</p>



<a name="163650217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650217">(Apr 18 2019 at 13:17)</a>:</h4>
<p>though I suppose this is somewhat silly</p>



<a name="163650291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650291">(Apr 18 2019 at 13:18)</a>:</h4>
<p>I think no, we shouldn't aim at integration from the outset: integration with rustc is a huge chunk of work, probably <em>larger</em> than just doing the thing from scratch.</p>



<a name="163650294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650294">(Apr 18 2019 at 13:18)</a>:</h4>
<p>i.e. anything that can work for an IDE (and that produces correct results), should be able to be hacked on in <em>some</em> manner to integrate with a batch compiler.</p>



<a name="163650318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650318">(Apr 18 2019 at 13:18)</a>:</h4>
<p>okay. I can go along with that</p>



<a name="163650331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650331">(Apr 18 2019 at 13:18)</a>:</h4>
<p>certainly sounds more palatable to me for the short term.</p>



<a name="163650351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650351">(Apr 18 2019 at 13:18)</a>:</h4>
<p>basically, the biggest value we can get here is wild experimentaion</p>



<a name="163650370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650370">(Apr 18 2019 at 13:19)</a>:</h4>
<p>another question that has arisen when I've posed the first claim above, that all we need to care about initially is replicating the behavior on <em>correct programs</em></p>



<a name="163650385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650385">(Apr 18 2019 at 13:19)</a>:</h4>
<p>right</p>



<a name="163650392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650392">(Apr 18 2019 at 13:19)</a>:</h4>
<p>that has led some to point out "IDE's may want to produce diagnostic suggestions on incorrect programs"</p>



<a name="163650404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650404">(Apr 18 2019 at 13:19)</a>:</h4>
<p>suggesting the changes the user might want to make</p>



<a name="163650417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650417">(Apr 18 2019 at 13:19)</a>:</h4>
<p>so there's a question of how much of that to plan ahead for</p>



<a name="163650485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650485">(Apr 18 2019 at 13:20)</a>:</h4>
<p>Do you have any thoughts there? Or is that something you think we can worry about <em>after</em> we get something running that only worries about correct programs?</p>



<a name="163650508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650508">(Apr 18 2019 at 13:20)</a>:</h4>
<p>Good question! An interesting aspect of dagnostics in IDE is that they should be structural (like in structured logging)</p>



<a name="163650551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650551">(Apr 18 2019 at 13:21)</a>:</h4>
<p>So, you don't print spans on stderr, you produce some blob of data specific to the problem, and handle these data in the "fixes" layer, completely outside of resolver</p>



<a name="163650574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650574">(Apr 18 2019 at 13:21)</a>:</h4>
<p>hmm. interesting</p>



<a name="163650596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650596">(Apr 18 2019 at 13:21)</a>:</h4>
<p>the fixes layer isn't expected to need to extract information from the Error value it gets from the resolver?</p>



<a name="163650662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650662">(Apr 18 2019 at 13:22)</a>:</h4>
<p>I was assuming it might want e.g. a way to see nearby names ("near" in the sense of string-matching)</p>



<a name="163650668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650668">(Apr 18 2019 at 13:22)</a>:</h4>
<p>it is expected: it should downcast error to a specific variant</p>



<a name="163650693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650693">(Apr 18 2019 at 13:22)</a>:</h4>
<p>Okay</p>



<a name="163650694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650694">(Apr 18 2019 at 13:22)</a>:</h4>
<p>smth like this: <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_api/src/diagnostics.rs#L39-L49" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_api/src/diagnostics.rs#L39-L49">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_api/src/diagnostics.rs#L39-L49</a></p>



<a name="163650781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650781">(Apr 18 2019 at 13:23)</a>:</h4>
<p>my current thinking, in any case, is that if the API is designed appropriately, then we should be able to swap in different name resolution libraries</p>



<a name="163650801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650801">(Apr 18 2019 at 13:23)</a>:</h4>
<p>where the library acting as the reference spec would produce Error objects that are practically <code>()</code></p>



<a name="163650888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650888">(Apr 18 2019 at 13:24)</a>:</h4>
<p>Yeah, seems resonable: create allowance for reporting errors, but report an ZST <code>struct NameresError;</code></p>



<a name="163650899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650899">(Apr 18 2019 at 13:24)</a>:</h4>
<p>actually, could we step back a bit</p>



<a name="163650910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650910">(Apr 18 2019 at 13:24)</a>:</h4>
<p>sure</p>



<a name="163650929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650929">(Apr 18 2019 at 13:25)</a>:</h4>
<p>What do we mean that we say "name resolution"?</p>



<a name="163650940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650940">(Apr 18 2019 at 13:25)</a>:</h4>
<p>heh</p>



<a name="163650956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650956">(Apr 18 2019 at 13:25)</a>:</h4>
<p>There's I think two rather orhogonal slices to the thing</p>



<a name="163650969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650969">(Apr 18 2019 at 13:25)</a>:</h4>
<p>the first one is "modules &amp; imports" bit, with fixed point, etc</p>



<a name="163650983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650983">(Apr 18 2019 at 13:25)</a>:</h4>
<p>right</p>



<a name="163650985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163650985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163650985">(Apr 18 2019 at 13:25)</a>:</h4>
<p>the second one is lexical scope stuff</p>



<a name="163651037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651037">(Apr 18 2019 at 13:26)</a>:</h4>
<p>which ... <em>might</em> have some overlap today?</p>



<a name="163651047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651047">(Apr 18 2019 at 13:26)</a>:</h4>
<p>I remember seeing some bug recently pointing out that you can write <code>impl</code> blocks within a <code>fn</code></p>



<a name="163651061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651061">(Apr 18 2019 at 13:26)</a>:</h4>
<p>oh yeah</p>



<a name="163651074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651074">(Apr 18 2019 at 13:26)</a>:</h4>
<p>Imports are also a "lexical scope stuff" with uniform paths.<br>
But with fixed point, etc!</p>



<a name="163651105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651105">(Apr 18 2019 at 13:27)</a>:</h4>
<p>oh hi <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> !</p>



<a name="163651115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651115">(Apr 18 2019 at 13:27)</a>:</h4>
<p>Hi <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> !</p>
<p>Hm, but even local imports look only for items?</p>



<a name="163651152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651152">(Apr 18 2019 at 13:27)</a>:</h4>
<p>Like, you can have "modules and imports" inside functions, but it's still doesn't really intersect with lexical scopes?</p>



<a name="163651216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651216">(Apr 18 2019 at 13:28)</a>:</h4>
<p>In other words, would erasing expressions in function bodies change the meaning of items in function bodies?</p>



<a name="163651265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651265">(Apr 18 2019 at 13:29)</a>:</h4>
<p>Right now imports referring to local variables / generic parameters are actively reported as errors.</p>



<a name="163651288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651288">(Apr 18 2019 at 13:29)</a>:</h4>
<p>(Rather than skipping local variables and searching for items in outer scopes.)</p>



<a name="163651403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651403">(Apr 18 2019 at 13:30)</a>:</h4>
<p>With successful compilation imports can only refer to items, yes (+ preludes, built-in things, etc).</p>



<a name="163651448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651448">(Apr 18 2019 at 13:31)</a>:</h4>
<p>playground example: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=faf6ea2a0543aa5eac9b503ca0a8b757" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=faf6ea2a0543aa5eac9b503ca0a8b757">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=faf6ea2a0543aa5eac9b503ca0a8b757</a></p>
<p>Yeah, that's... interesting</p>



<a name="163651466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651466">(Apr 18 2019 at 13:31)</a>:</h4>
<p>But I'd ideally want to unify the name search algorithm between early and late resolution, there are fewer differences than similarity now.</p>



<a name="163651474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651474">(Apr 18 2019 at 13:31)</a>:</h4>
<p>the reason why I seek this separation is that, in IDE, we <strong>really</strong> want to avoid name resolving function bodies</p>



<a name="163651484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651484">(Apr 18 2019 at 13:31)</a>:</h4>
<p>until we actually need to, eg, typecheck the function</p>



<a name="163651535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651535">(Apr 18 2019 at 13:32)</a>:</h4>
<p>isn't it enough to just delay such name resolution?</p>



<a name="163651574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651574">(Apr 18 2019 at 13:32)</a>:</h4>
<p>I suppose so. Like, they don't have to be two algoithms, they can be a single algorithm, operating on different sets of data</p>



<a name="163651577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651577">(Apr 18 2019 at 13:32)</a>:</h4>
<p>or is there some reason to avoid it, beyond latency?</p>



<a name="163651590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651590">(Apr 18 2019 at 13:33)</a>:</h4>
<p>Big-O complexity, basically</p>



<a name="163651606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651606">(Apr 18 2019 at 13:33)</a>:</h4>
<p>okay</p>



<a name="163651609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651609">(Apr 18 2019 at 13:33)</a>:</h4>
<p>there are <strong>far</strong> more body code than top-level code</p>



<a name="163651763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651763">(Apr 18 2019 at 13:35)</a>:</h4>
<p>I'd ignore erroneous imports referring to locals for a start, it's an extremely corner case.</p>



<a name="163651770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651770">(Apr 18 2019 at 13:35)</a>:</h4>
<p>it seems to me like we should be able to delay such work until you want to e.g. type-check or resolve trait impls.</p>



<a name="163651775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651775">(Apr 18 2019 at 13:35)</a>:</h4>
<p>Yeah.... I guess this is all for my "stepping a step back": we should try to find ways to be lazy with nameres.</p>



<a name="163651896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651896">(Apr 18 2019 at 13:37)</a>:</h4>
<p>with regards to using RA as the basis for an initial nameres library</p>



<a name="163651921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651921">(Apr 18 2019 at 13:37)</a>:</h4>
<p>well, not as basis, as a client: I feel the lib should be independent, and have its own IR, like chalk</p>



<a name="163651932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163651932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163651932">(Apr 18 2019 at 13:37)</a>:</h4>
<p>sure</p>



<a name="163652013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652013">(Apr 18 2019 at 13:38)</a>:</h4>
<p>my understanding is that RA today does not attempt to produce results that are always correct</p>



<a name="163652026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652026">(Apr 18 2019 at 13:39)</a>:</h4>
<p>That's very true</p>



<a name="163652156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652156">(Apr 18 2019 at 13:40)</a>:</h4>
<p>do you think it would be better to have a nameres library that has multiple modes, in terms of how fast it gives results vs the correctness of those results</p>



<a name="163652167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652167">(Apr 18 2019 at 13:40)</a>:</h4>
<p>or do you think its better to focus on correctness alone</p>



<a name="163652174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652174">(Apr 18 2019 at 13:41)</a>:</h4>
<p>and assume that we'll figure out ways to keep the latency under control?</p>



<a name="163652184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652184">(Apr 18 2019 at 13:41)</a>:</h4>
<p>What would "fast" mode do?</p>



<a name="163652191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652191">(Apr 18 2019 at 13:41)</a>:</h4>
<p>it might fail to resolve</p>



<a name="163652198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652198">(Apr 18 2019 at 13:41)</a>:</h4>
<p>due to not expanding macros, for example</p>



<a name="163652283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652283">(Apr 18 2019 at 13:42)</a>:</h4>
<p>I feel it's crucial to aim for "100% correct if we fix all the bugs"</p>



<a name="163652289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652289">(Apr 18 2019 at 13:42)</a>:</h4>
<p>okay</p>



<a name="163652310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652310">(Apr 18 2019 at 13:42)</a>:</h4>
<p>and it's very important to have lazyness, or, at least, incrementality</p>



<a name="163652329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652329">(Apr 18 2019 at 13:43)</a>:</h4>
<p>Basically, re-nameresolving after you modify function body should be fast</p>



<a name="163652355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652355">(Apr 18 2019 at 13:43)</a>:</h4>
<p>sure. I had said in the past that I figured one way to go here would be to have an asynchronous interface</p>



<a name="163652363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652363">(Apr 18 2019 at 13:43)</a>:</h4>
<p>If we can't do both "correct" and "lazy enough", that would be a pretty difficult position to be</p>



<a name="163652374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652374">(Apr 18 2019 at 13:43)</a>:</h4>
<p>with respect to the whole idea of using the same code base for compiler and ide, etc</p>



<a name="163652428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652428">(Apr 18 2019 at 13:44)</a>:</h4>
<p>I agree with that</p>



<a name="163652464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652464">(Apr 18 2019 at 13:44)</a>:</h4>
<p>I mostly was curious if, based on your work so far, if you thought that such a goal was not achievable in the first place.</p>



<a name="163652483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652483">(Apr 18 2019 at 13:44)</a>:</h4>
<p>(I suppose if you thought that, then we wouldn't be having this conversation at all)</p>



<a name="163652505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652505">(Apr 18 2019 at 13:45)</a>:</h4>
<p>I am now feeling more optimistic than initially :0)</p>



<a name="163652531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652531">(Apr 18 2019 at 13:45)</a>:</h4>
<p>okay. So I think the main action items I would like to look at</p>



<a name="163652537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652537">(Apr 18 2019 at 13:45)</a>:</h4>
<p>Salsa works wonders, and our (super-buggy) fixed-point iteration loop actually achives the required lazyness/latency</p>



<a name="163652627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652627">(Apr 18 2019 at 13:46)</a>:</h4>
<p>is to try to factor out code from RA that does name-resolution, and that validates its result against save-analysis</p>



<a name="163652666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652666">(Apr 18 2019 at 13:46)</a>:</h4>
<p>if I can get something running (and that presumably yields test failures on the appropirate cases exercising the bugs)</p>



<a name="163652697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652697">(Apr 18 2019 at 13:47)</a>:</h4>
<p>then that would be a proof-of-concept for what we're talking about here</p>



<a name="163652699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652699">(Apr 18 2019 at 13:47)</a>:</h4>
<p>Right?</p>



<a name="163652703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652703">(Apr 18 2019 at 13:47)</a>:</h4>
<p>sgmt</p>



<a name="163652715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652715">(Apr 18 2019 at 13:47)</a>:</h4>
<p>though, I would add a step before that</p>



<a name="163652716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652716">(Apr 18 2019 at 13:47)</a>:</h4>
<p>(and the main issue might be if its too tightly tied to rust-analyzer API stuff)</p>



<a name="163652724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652724">(Apr 18 2019 at 13:47)</a>:</h4>
<ul>
<li>scetch the IR required for name res</li>
</ul>



<a name="163652773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652773">(Apr 18 2019 at 13:48)</a>:</h4>
<p>(but being too tightly tied to rust-analyzer seems like a far better scenario than being too tightly tied to rustc API)</p>



<a name="163652786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652786">(Apr 18 2019 at 13:48)</a>:</h4>
<blockquote>
<ul>
<li>scetch the IR required for name res</li>
</ul>
</blockquote>
<p>ah yes, okay</p>



<a name="163652813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652813">(Apr 18 2019 at 13:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> if you feel like you need to run to that other thing, I feel we've discussed the most important bits :)</p>



<a name="163652830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652830">(Apr 18 2019 at 13:49)</a>:</h4>
<p>I think I do need to try to spend the next 10 minutes doing prep for the meeting that starts in 10 minutes.</p>



<a name="163652854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652854">(Apr 18 2019 at 13:49)</a>:</h4>
<p>thanks for this discussion, it has been super helpful food</p>



<a name="163652857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652857">(Apr 18 2019 at 13:49)</a>:</h4>
<p>for thought</p>



<a name="163652877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652877">(Apr 18 2019 at 13:50)</a>:</h4>
<p>I'll write notes and post them to rust-lang/compiler-team repo</p>



<a name="163652956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Name%20resolution%20librarification%202019-04-18/near/163652956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Name.20resolution.20librarification.202019-04-18.html#163652956">(Apr 18 2019 at 13:50)</a>:</h4>
<p>Thanks for participating <span class="user-mention silent" data-user-id="116083">pnkfelix</span>  and <span class="user-mention silent" data-user-id="123856">Vadim Petrochenkov</span> !</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>